package com.gsta.ifishery.netty.thread;

import java.util.concurrent.CountDownLatch;

import com.gsta.ifishery.netty.server.NettyServer;

/**
 * netty服务启动线程 . <br>
 * 
 * @author hkb
 */
public class NettyServerThread implements Runnable {

    /**
     * 计数器
     */
    public CountDownLatch latch;

    private NettyServerThread(CountDownLatch latch) {
        super();
        this.latch = latch;
    }

    public static NettyServerThread newNettyServerThread(CountDownLatch latch) {
        return new NettyServerThread(latch);
    }

    @Override
    public void run() {
        // 启动netty服务
        NettyServer.newNettyServer().run();
        // 计数器减一
        latch.countDown();
    }

}
